function fetch(options) {
	return new Promise(function (resolve, reject) {
		wx.request({
			url: options.url,
			data: options.data || {},
			header: options.header || {},
			method: options.method || 'get',
			dataType: options.dataType || 'json',
			responseType: options.responseType || 'text',
			success: (res) => {
				if (res.statusCode == 200) {
					resolve(res)
				}
			},
			fail: (res) => {
				reject(res)
				wx.showToast({
					title: res || '网络请求错误',
					duration: 3000,
					mask: true
				})
			},
			complete: (res) => { },
		})
	})

}

// 导出回调函数
module.exports = {
	fetchTime: fetch
}